﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;
using Entities;
using System.Data;

namespace BusinessLogicLayer
{
    public class TacGiaBO
    {
        private TacGiaDAL dal;
        public TacGiaBO()
        {
            try
            {
                dal = new TacGiaDAL();
            }
            catch (Exception e)
            {
                throw new BusinessLogicException();
            }
        }
        public TacGia GetTacGiaByID(int id)
        {
            TacGia tg = null;
            try
            {
                tg = dal.GetTacGiaByID(id);
            }
            catch (Exception)
            {
                throw;
            }
            return tg;
        }
        public TacGia GetIDByName(string name)
        {
            TacGia tg = null;
            try
            {
                tg = dal.GetIDByName(name);
            }
            catch (Exception)
            {
                throw;
            }
            return tg;
        }
        public DataTable GetDanhSachTacGia()
        {
            DataTable tl = null;
            try
            {
                tl = dal.GetDanhSachTacGia();
            }
            catch (Exception)
            {
                throw;
            }
            return tl;
        }
        public int InsertTacGia(TacGia tg)
        {
            int dt = 0;
            try
            {
                dt = dal.InsertTacGia(tg);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
        public int DeleteTacGia(string tacGia)
        {
            int dt = 0;
            try
            {
                dt = dal.DeleteTacGia(tacGia);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
        public int UpdateTacGia(TacGia tg)
        {
            int dt = 0;
            try
            {
                dt = dal.UpdateTacGia(tg);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
    }
}
